﻿//===========================[ 8 / 2 / 2011 LVI ]=============================
//				Copyright c Vitaly Lyaschenko <SkyChameleon@gmail.com>
// 								Header file
// Purpose: 
//=============================================================================
#pragma once

#include "common.h"

enum usageBuffer
{
	gl_STATIC_DRAW = 0x88E4,
	gl_STATIC_READ = 0x88E5,
	gl_STATIC_COPY = 0x88E6,
	gl_DYNAMIC_DRAW = 0x88E8,
	gl_DYNAMIC_READ = 0x88E9,
	gl_DYNAMIC_COPY = 0x88EA,
};

enum targetBuffer
{
	gl_ARRAY_BUFFER = 0x8892,
	gl_ELEMENT_ARRAY_BUFFER= 0x8893,
};

class cVBO
{
	uint m_VBOid;
	usageBuffer  m_usage;
	targetBuffer m_target;

public:
	cVBO( targetBuffer target, size_t size, const void *pData, usageBuffer usage );
	cVBO() 
	{ }

	void Create( targetBuffer target, size_t size, const void *pData, usageBuffer usage );
	void Bind();
	void Release();
	void Unbind();
	
	void Clear();

	uint getTarget() const { return m_target; }
	uint getUsage() const { return m_usage; }
	uint getId() const { return m_VBOid; }
};